package negocio.cliente.negocio;

import java.net.SocketException;
import java.util.concurrent.ConcurrentHashMap;

import negocio.beans.Conversa;
import base.transporte.SRSocket;
import base.transporte.SRWelcomer;

public class GerenteArquivos implements Runnable{
	
		private boolean listening;
		private Thread this_thread;

		public GerenteArquivos() {
			listening = true;
		}
		
		public void start(){
			this_thread = new Thread(this);
			this_thread.start();
		}
		
		public void stop(){
			this.listening = false;
			this.this_thread.interrupt();
		}
		
		@Override
		public void run() {
			try {
				SRWelcomer welcomer = new SRWelcomer(42002, "Gerente de Arquivos");
				while(listening){
					SRSocket skt = welcomer.accept();
					ReceptorArquivos receptor = new ReceptorArquivos(skt);
					receptor.start();
				}
			} catch (SocketException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
			
		}	
}
